﻿@using CoralNode.MvcClient.Helper
@{
    ViewData["Module"] = "Node";
    ViewData["curr"] = "block";
}
@Html.IncludePage("CoralAdmin/Node", "_Left")
<!--content-->
<div id="pbody">
    <div class="extra">
        <div class="pbody_top">
            <span class="ico ico_setting_system"></span><span class="t t_c">内容管理</span>
        </div>
        <div id="main">
            <div class="line_solid clearfix">
                <div class="content_slide">
                    <div class="select_owner w_10-5 " data-meta="{value:'@ViewBag.Query.Type', btn:'<span class=\'ico ico_slide_down\'></span>' , clickbtn:'<span class=\'ico ico_slide_up\'></span>'}">
                        <ul>
                            <li data-value=""><a href="/m/node/listblock">所有内容块</a></li>
                            @foreach (var item in ViewBag.BlockTypeList)
                            {
                                if (item.Value == @ViewBag.Query.Type) {
                                    <li data-value="@item.Value"><a class="current" href="/m/node/listblock?Type=@item.Value">@item.Key</a>
                                    </li>
                                } else {
                                    <li data-value="@item.Value"><a  href="/m/node/listblock?Type=@item.Value">@item.Key</a>
                                    </li>
                                }
                            }
                        </ul>
                    </div>
                    <div class="nav_left">
                        <div class="border-top1 pb_1"></div>
                        <ul>
                            @foreach (var item in Model) {
                                <li><a class="j_ajax_load" href="/m/node/BlockDetail/@item.Id">@item.Title</a></li>
                            }
                        </ul>
                    </div>
                </div>
                <div class="ml_12">
                    <div class="js_ajaxLoad ">
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>
<div id="overlay" class="clearfix overlay w_90">
    <div class="js-overlay-node"></div>
</div>

<script type="text/javascript">

    function ajaxLoad(obj, callback) {
        $.ajax({
            url: $(obj).attr("href"),
            beforeSend: function () {
                $('.loading').show();
            },
            success: function (data) {
                $('.js_ajaxLoad').html(data);
                $('.loading').hide();
                if (callback != undefined) {
                    callback();
                }
                else {

                }
            }
        });
    }

    $(document).ready(function () {
        $('.js_ajaxdel').live("click", function (e) {
            e.preventDefault();
            var $this = $(this);
            $.confirm("确认删除么", function () {
                $.post($this.attr("href"), function () {
                    $this.parents('tr').remove();
                });
            });
        });
        $('.j_ajax_load').live("click", function (e) {
            e.preventDefault();
            $(this).parent().addClass('current').siblings().removeClass('current');
            ajaxLoad($(this), function () { });
        }).first().trigger("click");
        $('.j_status_filter').live("change", function () {
            var href = $(this).attr("href");
            $(this).attr("href", href + $(this).val());
            ajaxLoad($(this), function () { });
        });
    });
</script>
